package com.market.cash.configs

import com.market.cash.CashRootApps
import com.market.cash.utils.helper.SharedHelper
import com.market.cash.utils.language.LocaleContract
import com.market.cash.utils.language.MultiLanguages

/**
 * CashRoot
 * @Author wwdeng
 * @CreateTime: 2024/10/15 10:59
 * @Annotation：APP 配置
 */
object CashRootConfigs {

    /**
     * APP 名称
     */
    const val CASHROOT_APPNAME = "CASHROOT"

    /**
     * 包名
     */
    const val CASHROOT_PACKAGENANME = "com.creditroot.duration.loanapp"

    /**
     * 加解密
     */
    const val CASHROOT_AES_KEY = "kCj2QMs4QlKqK0Mv"
    const val CASHROOT_AES_IV = "gt5IvG2FAQIQ2nCj"

    /**
     * Adjust
     */
    const val CASHROOT_ADJ_TOKEN = "ugl3xok8mpds"
    const val CASHROOT_ADJ_EVENT_REGISTER = "ctt8ik"
    const val CASHROOT_ADJ_EVENT_APPLY = "lcnjae"

    /**
     * 是否是法语地区
     *  desc：地区转发（timeZone） 以 fcfa、xaf、senegal 结尾，则定义为法语地区
     */
    fun isFrench(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("fcfa") || timeZone.endsWith("xaf") || timeZone.endsWith("senegal")
    }

    /**
     * 加纳 233
     */
    fun isGha(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("gha")
    }

    /**
     * 肯尼亚 254
     */
    fun isKsh(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("ksh")
    }

    /**
     * 乌干达 256
     */
    fun isUgx(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("ugx")
    }

    /**
     * 科特迪瓦 225
     */
    fun isFcfa(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("fcfa")
    }

    /**
     * 喀麦隆  237
     */
    fun isXaf(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("xaf")
    }

    /**
     * 赞比亚 	260
     */
    fun isZmb(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("zmb")
    }

    /**
     * 塞内加尔  221
     */
    fun isSenegal(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("senegal")
    }

    /**
     * 坦桑尼亚  255
     */
    fun isTanz(): Boolean{
        val timeZone = SharedHelper.getCashRootSPString(SharedHelper.CashRoot_SPKEY.CASHROOT_TIMEZONE)
        return timeZone.endsWith("tanz")
    }

    /**
     * 是否是斯瓦西里语
     */
    fun isSwahili(): Boolean{
        if (isTanz()) {
            val curtLocale = MultiLanguages.getAppLanguage(CashRootApps.app.getAppContext())
            when (curtLocale.language) {
                LocaleContract.getSwahiliLocale().language -> {//坦桑
                    return true
                }
            }
        }
        return false
    }

}